package com.baidu.process.chat.core.web.controller;

import com.baidu.process.chat.core.web.bean.IMRequestServer;
import com.baidu.process.chat.core.web.bean.IMResponseResult;
import com.baidu.process.chat.core.web.service.IMService;
import com.baidu.process.chat.core.web.service.impl.IMServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:fangyuchao
 * @Description:
 * @Date: Create in 9:58 2022/11/7
 */
@RestController
public class ImChatController {
    private static final Logger logger= LoggerFactory.getLogger(ImChatController.class);
    @Autowired
    private IMService imService;


    @RequestMapping("/adapter/unit/query")
    public IMResponseResult chatQuery(@RequestBody IMRequestServer imRequestServer){
        String type = imRequestServer.getType();
        imRequestServer.setStartTime(Long.toString(System.currentTimeMillis()));
        //1为文本消息，走ngd识别
        if ("1".equals(type)){
            return imService.commonChat(imRequestServer);
        }else{
            return  imService.custServerChat(imRequestServer);
        }


    }









}
